using Game.Scripts.Constant;
using Game.Scripts.Service;
using UnityEngine;
using Zenject;

namespace Game.Scripts.Entity.UI.NextGameMenu
{
    public class NextGameButton : MonoBehaviour
    {
        [SerializeField] private Animator animator;

        
        private GameService _gameService;
        private NextGameMenu _nextGameMenu;
        private RoadTileService _roadTileService;
        
        [Inject]
        public void Construct(GameService gameService, NextGameMenu nextGameMenu, RoadTileService roadTileService)
        {
            _gameService = gameService;
            _nextGameMenu = nextGameMenu;
            _roadTileService = roadTileService;
        }

        
        
        public void HandleButtonClick()
        {
            animator.SetTrigger(ButtonAnimationParameter.ButtonClicked);
        }
        
        public void HandleButtonAnimationComplete()
        {
            _nextGameMenu.Close();
            _nextGameMenu.UndoBlur();
            _roadTileService.ClearMarkedEndPoint();
            _gameService.GoToNextGameLevel();
        }
    }
}